﻿<UserControl x:Class="Framework.UI.TestHarness.Views.ListBoxView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:metro="http://schemas.codeplex.com/elysium"
             xmlns:params="http://schemas.codeplex.com/elysium/params"
             xmlns:extra="http://schemas.extra.com/ui"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        
        <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}" 
                   Text="ListBox"/>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            
            <ListBox x:Name="ListBox" 
                     DisplayMemberPath="Name"
                     ItemsSource="{Binding Funds}" 
                     Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                     Width="300">
                <ListBox.ItemContainerStyle>
                    <Style BasedOn="{StaticResource {x:Type ListBoxItem}}" TargetType="{x:Type ListBoxItem}">
                        <Setter Property="extra:ListBoxItemAttached.IsDeselectionEnabled" Value="{Binding Path=IsChecked, ElementName=IsRowDeselectionEnabledToggleSwitch}"/>
                    </Style>
                </ListBox.ItemContainerStyle>
            </ListBox>
            
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                
                <TextBlock Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                           Style="{StaticResource HeaderTextStyle}" 
                           Text="Standard Properties"/>
                <Grid Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Content="SelectionMode"
                           Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                           Target="{Binding ElementName=SelectionModeComboBox}"/>
                    <ComboBox x:Name="SelectionModeComboBox" 
                              Grid.Column="1"
                              SelectedItem="{Binding ElementName=ListBox, Mode=TwoWay, Path=SelectionMode}"
                              Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}">
                        <SelectionMode>Extended</SelectionMode>
                        <SelectionMode>Multiple</SelectionMode>
                        <SelectionMode>Single</SelectionMode>
                    </ComboBox>

                </Grid>

                <TextBlock Grid.Row="2" 
                           Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                           Style="{StaticResource HeaderTextStyle}" 
                           Text="Custom Properties"/>
                <Grid Grid.Row="3">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Label Content="IsRowDeselectionEnabled (Enabled by Default)"
                           Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                           Target="{Binding ElementName=IsRowDeselectionEnabledToggleSwitch}"
                           ToolTip="Click on a row while it is selected to deselect it"/>
                    <metro:ToggleSwitch x:Name="IsRowDeselectionEnabledToggleSwitch" 
                                        Grid.Column="1"
                                        HorizontalAlignment="Left"
                                        IsChecked="True"
                                        Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                        ToolTip="Click on a row while it is selected to deselect it"/>
                </Grid>
                
            </Grid>

        </Grid>
        
        <TextBlock Grid.Row="2"
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}" 
                   Text="Fish Eye ListBox"/>
        <ListBox Grid.Row="3"
                 ItemsSource="{Binding Funds}" 
                 Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                 Style="{StaticResource FishEyeListBoxStyle}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <extra:Icon Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"
                                    Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                                    Size="Large"
                                    Style="{StaticResource User1IconStyle}"/>
                        <TextBlock Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}"
                                   Margin="{Binding Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter='Left, Right, Bottom', RelativeSource={RelativeSource Self}, Path=(params:General.BoldPaddingValue), Mode=OneWay}"
                                   Style="{StaticResource HeaderTextStyle}" 
                                   Text="{Binding Name}"
                                   TextAlignment="Center"
                                   VerticalAlignment="Center"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <TextBlock Grid.Row="4"
                   Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                   Style="{StaticResource HeaderTextStyle}" 
                   Text="Notes ListBox"/>
        <extra:NotesListBox Grid.Row="5"
                          ItemsSource="{Binding Funds}" 
                          Margin="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.BoldPadding), Mode=OneWay}"
                          VerticalContentAlignment="Bottom">
            <extra:NotesListBox.ItemContainerStyle>
                <Style BasedOn="{StaticResource {x:Type extra:NotesListBoxItem}}" TargetType="{x:Type extra:NotesListBoxItem}">
                    <Setter Property="PinCommand" Value="{Binding Path=DataContext.PinCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
                    <Setter Property="PinCommandParameter" Value="{Binding}"/>
                </Style>
            </extra:NotesListBox.ItemContainerStyle>
            <extra:NotesListBox.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Style="{StaticResource HeaderTextStyle}" 
                               Text="{Binding Name}"/>
                </DataTemplate>
            </extra:NotesListBox.HeaderTemplate>
            <extra:NotesListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Control DataContext="{Binding ElementName=RichTextBox}">
                            <Control.Style>
                                <Style BasedOn="{StaticResource RichTextBoxToolbarSmallIcons}" TargetType="{x:Type Control}">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Path=IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type extra:NotesListBoxItem}}}" Value="False">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Control.Style>
                        </Control>
                        <extra:RichTextBoxExtended x:Name="RichTextBox"
                                                 Grid.Row="1"
                                                 Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras rutrum malesuada tortor suscipit ultrices. Mauris dictum ullamcorper luctus. Vivamus et facilisis purus, eget facilisis libero. Fusce et nibh vel tortor viverra hendrerit at et tellus. Nulla tempor lectus nunc, sed eleifend urna viverra a. Vestibulum laoreet nibh sapien, a vulputate velit viverra et. In quis convallis orci, at rutrum augue. In sit amet feugiat turpis, nec aliquet purus. Aliquam nunc justo, sodales at lacus et, vulputate aliquet ante."/>
                    </Grid>
                </DataTemplate>
            </extra:NotesListBox.ItemTemplate>
        </extra:NotesListBox>

    </Grid>
</UserControl>
